<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-content">
                <form class="form-horizontal m-t" id="signupForm">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">作者：</label>
                        <div class="col-sm-8">
                            <input id="author" name="author" class="form-control"
                                   type="text" value="${property.author!}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">邮箱：</label>
                        <div class="col-sm-8">
                            <input id="email" name="email" class="form-control" type="text" value="${property.email!}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">包名：</label>
                        <div class="col-sm-8">
                            <input id="package" name="package" class="form-control"
                                   type="text" value="${property.package!}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">去掉指定表前缀：</label>
                        <div class="col-sm-8">
                            <input id="tablePrefix" name="tablePrefix" class="form-control"
                                   type="text" value="${property.tablePrefix!}">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $().ready(function () {
        validateRule();
    });

    function update() {
        $.ajax({
            cache: true,
            type: "POST",
            url: "/common/generator/update",
            data: $('#signupForm').serialize(),
            async: false,
            error: function (request) {
                parent.layer.alert("网络连接超时");
            },
            success: function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg);
                    layer.close(current_index);
                } else {
                    layer.msg(data.msg);
                }

            }
        });

    }

    function validateRule() {
        var icon = "<i class='fa fa-times-circle'></i> ";
        $("#signupForm").validate({
            rules: {
                author: {
                    required: true
                },
                email: {
                    required: true
                },
                package: {
                    required: true
                },

            },
            messages: {

                author: {
                    required: icon + "请输入作者"
                },
                email: {
                    required: icon + "请输入email"
                },
                package: {
                    required: icon + "请输入包名"
                },
            },
            submitHandler: function () {
                update();
            }
        })
    }
</script>